#!/bin/bash
# Author: afei
# Resource: https://access.redhat.com/security/vulnerabilities/RHSB-2021-002
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

. /etc/os-release

case "$VERSION_ID" in
	7)
	debuginfo-install -y kernel-"$(uname -r)" 
	;;
	6|8)
	debuginfo-install -y sudo
	;;
esac

Create_systemtap(){
	#install rely
	yum -y install systemtap yum-utils kernel-devel-“ $（uname -r）”
	cat >> /sudoedit-block.stap << "EOF"
probe process("/usr/bin/sudo").function("main")  {
        command = cmdline_args(0,0,"");
        if (isinstr(command, "edit")) {
                raise(9);
        }
}
EOF
nohup stap -g /sudoedit-block.stap &
}

Create_systemtap